//
//  UIView+BL.m
//  BLWeather
//
//  Created by 大L君的无敌战舰 on 16/4/14.
//  Copyright © 2016年 bigL.com. All rights reserved.
//

#import "UIView+BL.h"

@implementation UIView (BL)


- (UIViewController *)viewController{
    if (!self.superview) {
        return (UIViewController *)[self nextResponder];
    }
    for (UIView *next = self.superview; next; next = next.superview) {
        UIResponder *nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)nextResponder;
        }
    }
    return nil;
}
@end
